package cn.edu.nuc.ssm.dto;

import cn.edu.nuc.ssm.entity.Category;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/4/18.
 */
public class ConsumeAnalyDtoArr {

    private List<ConsumeAnalyDto> list = new ArrayList<>();

    public ConsumeAnalyDtoArr() {
    }

    public ConsumeAnalyDtoArr(List<Category> initCategory, List<ConsumeAnalyDto> listParam) {
        int size = initCategory.size();

        for (int i = 0 ; i < size ; i++){
            ConsumeAnalyDto c =new ConsumeAnalyDto();
            c.setName(initCategory.get(i).getName());
            list.add(c);
        }
        for(int i = 0 ; i < size ; i++){
            String name = list.get(i).getName();
            for (int j=0 ; j < listParam.size() ; j++){
                if (name.equals(listParam.get(j).getName())){
                    list.get(i).setValue(listParam.get(j).getValue());
                }
            }
        }
    }


    public List<ConsumeAnalyDto> getList() {
        return list;
    }

    public void setList(List<ConsumeAnalyDto> list) {
        this.list = list;
    }
}
